package 算法.leetcode周赛.Test242;

/**
 * @author:谢君臣
 * @Date:2021/5/24-10:07
 * @version:1.0
 * @function:
 */
public class lc哪种连续子字符串更长 {
    public static void main(String[] args) {
        System.out.println(checkZeroOnes("1101"));
    }
    public static boolean checkZeroOnes(String s) {
       int i=0,n=0,m=0;
       while (i<s.length()){
           int j = i;
           while (j<s.length()&&s.charAt(j)=='0')j++;n = Math.max(n,j-i+1);
           i = j;
           while (j<s.length()&&s.charAt(j)=='1')j++;m = Math.max(m,j-i+1);
           i = j;
       }
       return m>n;
    }



}
